﻿using System;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using AnyOffice.Components;
using AnyOffice.DAL;

namespace AnyOffice.general.rms.roll_lend
{
    public partial class read_roll : ModulePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.Page.IsPostBack)
            {
                int rollId = (Request.QueryString["roll_id"] != null) ? int.Parse(Request.QueryString["roll_id"].ToString()) : 0;
                DataTable table = new RmsRollDao().SelectByRollId(base.Conn, rollId);
                if (table.Rows.Count > 0)
                {
                    this.litRollCode.Text = table.Rows[0]["RollCode"].ToString();
                    this.litRollName.Text = table.Rows[0]["RollName"].ToString();
                    this.litRoomName.Text = table.Rows[0]["RoomName"].ToString();
                    if (table.Rows[0]["Years"] != DBNull.Value)
                    {
                        this.litYears.Text = table.Rows[0]["Years"].ToString();
                    }
                    if (table.Rows[0]["BeginDate"] != DBNull.Value)
                    {
                        this.litBeginDate.Text = Convert.ToDateTime(table.Rows[0]["BeginDate"].ToString()).ToString("yyyy-MM-dd");
                    }
                    if (table.Rows[0]["EndDate"] != DBNull.Value)
                    {
                        this.litEndDate.Text = Convert.ToDateTime(table.Rows[0]["EndDate"].ToString()).ToString("yyyy-MM-dd");
                    }
                    if (table.Rows[0]["DeptName"] != DBNull.Value)
                    {
                        this.litDeptName.Text = table.Rows[0]["DeptName"].ToString();
                    }
                    if (table.Rows[0]["BZJG"] != DBNull.Value)
                    {
                        this.litBZJG.Text = table.Rows[0]["BZJG"].ToString();
                    }
                    if (table.Rows[0]["DeadLine"] != DBNull.Value)
                    {
                        this.litDeadLine.Text = table.Rows[0]["DeadLine"].ToString();
                    }
                    if (table.Rows[0]["Secret"] != DBNull.Value)
                    {
                        this.litSecret.Text = new RmsCodeDao().GetCodeName(base.Conn, table.Rows[0]["Secret"].ToString(), RmsCodeDao.CodeType.Secret);
                    }
                    if (table.Rows[0]["CategoryNo"] != DBNull.Value)
                    {
                        this.litCategoryNo.Text = table.Rows[0]["CategoryNo"].ToString();
                    }
                    if (table.Rows[0]["CatalogNo"] != DBNull.Value)
                    {
                        this.litCatalogNo.Text = table.Rows[0]["CatalogNo"].ToString();
                    }
                    if (table.Rows[0]["ArchiveNo"] != DBNull.Value)
                    {
                        this.litArchiveNo.Text = table.Rows[0]["ArchiveNo"].ToString();
                    }
                    if (table.Rows[0]["BoxNo"] != DBNull.Value)
                    {
                        this.litBoxNo.Text = table.Rows[0]["BoxNo"].ToString();
                    }
                    if (table.Rows[0]["MicroNo"] != DBNull.Value)
                    {
                        this.litMicroNo.Text = table.Rows[0]["MicroNo"].ToString();
                    }
                    if (table.Rows[0]["CertificateKind"] != DBNull.Value)
                    {
                        this.litCertificateKind.Text = new RmsCodeDao().GetCodeName(base.Conn, table.Rows[0]["CertificateKind"].ToString(), RmsCodeDao.CodeType.CertificateKind);
                    }
                    if (table.Rows[0]["CertificateStart"] != DBNull.Value)
                    {
                        this.litCertificateStart.Text = table.Rows[0]["CertificateStart"].ToString();
                    }
                    if (table.Rows[0]["CertificateEnd"] != DBNull.Value)
                    {
                        this.litCertificateEnd.Text = table.Rows[0]["CertificateEnd"].ToString();
                    }
                    if (table.Rows[0]["RollPage"] != DBNull.Value)
                    {
                        this.litRollPage.Text = table.Rows[0]["RollPage"].ToString();
                    }
                    if (table.Rows[0]["Remark"] != DBNull.Value)
                    {
                        this.litRemark.Text = table.Rows[0]["Remark"].ToString();
                    }
                }
                else
                {
                    this.pnlMain.Visible = false;
                    this.litMessage.Text = base.ShowPromptClose("无此案卷");
                }
            }


        }
    }
}
